<script>
    var now = new Date();
    var year = prompt("请输入出生年份");
    var age = now.getFullYear()-year;
    alert("今年您"+age+"岁了")
</script>